----------------------------------Spell Variables--------------------------------------
SPELL.m_iSpellID = 13003 -- Whatever value you want as long as it doesn't override any other spells' IDs.
SPELL.m_iRange = 1024
SPELL.m_sName = "XxX_MLG_XxX"
SPELL.m_sToolTip =	[[Oh baby, a triple!]]
SPELL.m_sIcon = "devin/blackbetty/spells/warrior/dew.png"
SPELL.m_iCoolDown = 90
SPELL.m_iManaCost = 0
SPELL.m_bRequiresTarget = true
SPELL.m_iSpellType = SPELLTYPE_MAA
SPELL.m_bRecastWhileCasting = false

---------------------------------------------------------------------------------------

function SPELL:Cast( pl, target )
	local weapon = pl:GetWeapon("weapon_all")
	local target = pl:GetNetworkedEntity("Target")
	local range = self.m_iRange
		
	pl:EmitSound("devin/blackbetty/weapons/mlg.wav", 150, 100)
	pl:EmitSound("devin/blackbetty/weapons/mlg.wav", 150, 100)
	pl:EmitSound("devin/blackbetty/weapons/mlg.wav", 150, 100)
	
	pl.ArmorStat = 100
	
	net.Start( "SendPlayerCast" )
	local SendTable = {90, self.m_sName, Color(35, 155, 35, 255)}
	net.WriteTable(SendTable)
	net.Send(pl)
	
	timer.Create(""..pl:EntIndex().."bladestormanim", 0.8, 110, function()
		pl:DoAnimationEvent(ACT_DI_ALYX_ZOMBIE_MELEE)
		pl:EmitSound("devin/blackbetty/weapons/mlgsnipe.wav", 80, 100)
		ParticleEffect( "thunder_clap", pl:GetPos(), Angle(0,0,0), pl )
		self:Effect(pl, target)
	end)
	
	timer.Simple(29.5, function()
		timer.Create("MLGPRO"..pl:GetName().."", 0.05, 1200, function()
			self:Effect(pl, target)
		end)
	end)
end

function SPELL:Effect(pl, target)
	local whirlRadius = ents.FindInSphere(pl:GetPos(), 240)
	s = table.Random(Spells)
	e = table.Random(whirlRadius)
	print(e:GetClass())
	if(e != pl and e:GetClass() != "prop_physics" and e:GetClass() != "weapon_all" and e:GetClass() != "predicted_viewmodel")then
		pl:EmitSound("devin/blackbetty/weapons/mlgsnipe.wav", 80, 100)
		local rand = math.random(1,3)
		if(rand == 1)then
			ParticleEffect( "thunder_clap", e:GetPos(), Angle(0,0,0), e )
			e:EmitSound("devin/blackbetty/weapons/hit/Fire"..math.random(1,3)..".wav", 150, 100)
		elseif(rand == 2)then
			ParticleEffect( "impact_hit", e:GetPos(), Angle(0,0,0), e )
			ParticleEffect( "impact_hit", e:GetPos(), Angle(0,0,0), e )
			ParticleEffect( "impact_hit", e:GetPos(), Angle(0,0,0), e )
			e:EmitSound("physics/concrete/boulder_impact_hard"..math.random(1,3)..".wav", 150, 100)
		elseif(rand == 3)then
			ParticleEffect( "bomb_explosion", e:GetPos(), Angle(0,0,0), e )
			pl:EmitSound("ambient/explosions/explode_1.wav", 150, 100)
		end
		s:Effect(pl, e, 1)
	end
end





